package teaching.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import teaching.pojo.Student;

import java.util.List;

/**
 * Author:20201002983_郑雨蓓
 * Date: 2024/3/9
 * Description:
 */
public interface StudentMapper extends BaseMapper<Student> {
    @Select("select * from student where id=#{id}")
    Student findById(@Param("id") Long id);

    @Select("select * from student where username = #{username}")
    Student findByUserName(@Param("username") String username);

    @Insert("insert into student(username,password) values (#{student.username},#{student.password})")
    int register(@Param("student") Student student);

    @Select("select student.name from student where id=#{studentId}")
    String getStudentName(Long studentId);
    @Select("select * from student")
    List<Student> listAllStudent();
}
